﻿using System.Web.Mvc;
using FluentWebRequest;
using UI.Models;

namespace UI.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            //var vv = submitter.WithUrl("http://www.facebook.com/directory/people/A").GetDataFromUrl(RequestMethodType.Get);

            var result = RequestSubmitter.GetInstance()//.WithUrl("http://www.bbc.co.uk").GetDataFromUrl(RequestMethodType.Get);

            .WithUrl("http://www.bbc.co.uk/search/news/")
                .Item.WithNameIs("q").ValueIs("Queen Elizabeth II")
                .ConnectWith.Item.WithNameIs("video").ValueIs("on")
                .ConnectWith.Item.WithNameIs("audio").ValueIs("on")
                .ConnectWith.Item.WithNameIs("text").ValueIs("on")
            .WithRequestTypeIs(RequestMethodType.Post)
            .BuildUrl().GetDataFromUrl();

            var model = new HomeViewModel();
            model.HtmlString = result;

            return View(model);
        }
    }
}